package nq;

public class Pan {
    private static int GZ[][]=new int[8][8];

    public void intiPan(){
        for(int i=0;i<8;i++){
            for (int j=0;j<8;j++){
                GZ[i][j]=0;
            }
        }
    }

    //判断是否为安全格子
    protected boolean ShiFouAnQuan(int x,int y){
        if(GZ[x][y]==0)
            return true;
        else
            return false;
        }

    //调整格子性质
    protected void TiaoZheng(int x,int y){
        GZ[x][y]=2;//Q本身的格子
        for (int i=0;i<8;i++){
            for (int j=0;j<8;j++){
                if((i==x)||(j==y)||(i-j==x-y)||(i+j==x+y))
                    {GZ[x][y]=1;}
            }

        }
    }

    //显示
    protected void XianShi(){
        for (int i=0;i<8;i++){
            for (int j=0;j<8;j++){
                System.out.print(GZ[i][j]+"  ");
            }
            System.out.println();
        }
    }
}
